import { post, del } from '../../../utils/request';
import { getCurrentTenant } from '../../../utils/utils';

const saveChannel = data => post('mgt/channel/save', data);

const commitChannel = data => post('mgt/channel/commit', { ...data, tenantCode: (getCurrentTenant() || { tenantCode: '' }).tenantCode[0] });

const modChannel = data => post('mgt/channel/mod', data);

const delChannel = data => post('mgt/channel/del', data);

const channelList = data => post('mgt/channel/list', { ...data, tenantCodeList: (getCurrentTenant() || { tenantCode: '' }).tenantCode });

const channelTop = data => post('mgt/channel/top', data);

const channelDetail = data => post('mgt/channel/detail', data);

const dingcompanygroup = data => post('mgt/dingding/dingcompanygroup', data);
const dingcompanygrouplist = data =>
  post('mgt/dingding/dingcompanygrouplist', data);
const dingcompanygroupdel = id => del(`mgt/dingding/dingcompanygroup?id=${id}`);

export default {
  saveChannel,
  commitChannel,
  modChannel,
  delChannel,
  channelList,
  channelTop,
  channelDetail,
  dingcompanygroup,
  dingcompanygrouplist,
  dingcompanygroupdel
};
